<!DOCTYPE html>
<html>
	<head>
	    <meta charset="utf-8">
	    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
	    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
	    <title>Hello APP</title>
	    <link rel="stylesheet" type="text/css" href="../../../css/index.css" />
	</head>
	<style type="text/css">
		.warp{width: 100%;}
		input::-webkit-input-placeholder{color: #BBBBBB;font-size: 14px;}
		input::-moz-placeholder{color: #BBBBBB;font-size: 14px;}

		textarea::-webkit-input-placeholder{color: #BBBBBB;font-size: 14px;}
		textarea::-moz-placeholder{color: #BBBBBB;font-size: 14px;}
		.img-box{width: 100%;height: auto;}
		.img-box img{width: 100%;display: block;}

		.info-box{width: 100%;}
		.info-box .info-one{align-items: center;height: 50px;padding: 0 15px;background: #FFFFFF;box-sizing: border-box;}
		.info-box .info-one .text{padding-right: 18px;box-sizing: border-box;}
		.info-box .info-one input{padding: 10px 0;line-height: 30px;box-sizing: border-box;}
		.info-box .info-one.goto{background: url(../../../image/main3/main3_goto.png) no-repeat right 10px center #FFFFFF;background-size:14px;padding-right: 30px;}
		.tishi{padding: 15px;box-sizing: border-box;color: #999999;}
		.tixian{margin: 40px 15px;background: #FF9502;border-radius: 30px;height: 44px;text-align: center;line-height: 44px;font-size: 16px;color: #ffffff;}

	</style>
	<body>
		<div id="vue" class="warp">
			<div class="info-box">
				<div class="info-one flex goto border-bottom" tapmode onclick="tabWay(this)">
	        		<div class="text">物流公司</div>
	        		<input class="flex1" type="text" readonly="readonly" id="kdname" placeholder="请选择快递公司"/>
	        	</div>
				<div class="info-one flex">
	        		<div class="text">物流单号</div>
	        		<input class="flex1" type="text" id="danhao" placeholder="请输入物流单号"/>
	        	</div>
	        </div>
			<div class="tishi">请输入物流单号，通过物流 AP 可以查看物流状态</div>
			<div class="tixian" tapmode onclick="upData(this)" >提交</div>
		</div>
	</body>
</html>
<script type="text/javascript" src="../../../script/base.min.js" id="loadjs" data-js="L/swiper.min,L/lazyload,L/h-tool"></script>
<script type="text/javascript">

	define(function (require, exports, module) {

		var sdata = {};
		var data = pageParam.data;
		sdata.orderid = pageParam.id;
		sdata.ftype = pageParam.type || '';

		lanYun.newVue('#vue',{

		},function() {

		});

		if(pageParam.type == "edit"){
			sdata.kd_id = pageParam.kdid;
			$('#kdname').val(pageParam.name);
			$('#danhao').val(pageParam.code);
		}

		//选择快递
		tabWay = function(){
			lanYun.actionSelect({
				col:1,
				data:data,
				title:'请选择快递公司',
				successCall:function(result){
					if(result && result.eventType == 'ok' && result.selectedInfo){
						var result_data = result.selectedInfo[0];
						$('#kdname').val(result_data.name);
						sdata.kd_id = result_data.id;
					}
				}
			});
		};

		// 提交发货信息
		upData = function (){
			sdata.kd_code = $('#danhao').val();
			if(!sdata.kd_id){
				lanYun.toast("请选择物流公司");
				return;
			}
			if(!sdata.kd_code){
				lanYun.toast("请输入快递单号");
				return;
			}
			//console.log(JSON.stringify(sdata));
			lanYun.post('store/Order/fahuo',sdata,function (ret) {
				lanYun.toast(ret.msg);
				if(ret.errcode == 0 ){
					lanYun.setStorage('reshpage',1);
					setTimeout(function(){
						api.closeWin();
					},800)
				}
			},2)
		}

	});
</script>
